<include file="../header" />
<body class="J_scroll_fixed">
<script type="text/javascript" src="__ROOT__/statics/js/ajaxfileupload.js"></script>
<script type="text/javascript" src="__ROOT__/statics/js/ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="__ROOT__/statics/js/ueditor/ueditor.all.min.js"></script>

<link href="__ROOT__/statics/select2/dist/css/select2.min.css" rel="stylesheet" />
<script src="__ROOT__/statics/select2/dist/js/select2.min.js"></script>
<script src="__ROOT__/statics/select2/dist/js/i18n/zh-CN.js"></script>
<script type="text/javascript">
        $(function () {

            $("button#send").click(function() {

                var number = $("input[name=number]").val();

                if(number == "") {
                    alert("数量不能为空");
                    return false;
                }

                $("form").submit();

            });

            $.ajax({
                url: "{:U('Product/robotList')}",
                type: "POST",
                dateType: "json",
                data: {
                    id: "{$id}"
                },
                success: function (data) {
                    var selectData = data.results;
                    $("#customerId").select2({
                        language: "zh-CN",
                        data: selectData
                    })
                }
            });

        });
    </script>
    <div class="wrap jj">

        <div class="common-form">
            <form  id='add' method="post" class="form-horizontal J_ajaxForm" action="{:U('product/createGroupPost')}">
                <input type="hidden" name="roundId" value="{$id}" />
                <fieldset>
                    <div class="control-group">
                        <label class="control-label">机器人用户:</label>
                        <div class="controls">
                            <select id="customerId" name="customerId">

                            </select>
                        </div>
                    </div>

                    <div class="control-group">
                        <label class="control-label">购买份数:</label>
                        <div class="controls">
                            <input type="text" class="input" name="number" value="1">
                        </div>
                    </div>

                </fieldset>

                <div class="form-actions">
                    <button id="send" type="button" class="btn btn-primary">购买</button>
                </div>
            </form>
        </div>
    </div>
    <script src="__ROOT__/statics/js/common.js"></script>
</body>
</html>